<?php

namespace app\ruinuo\config\lists;
use app\common\model\RuinuoLists as DataMode;
class Info
{
    public function Model()
    {
        return new DataMode();
    }

    public function ListModel()
    {
        $Model=new DataMode();
        $DB=$Model->alias('a');
        return $DB;
    }

    public function InfoMode()
    {
        $data=[
            'app_id'=>'1',
            'app_num'=>'ruinuo',
            'app_name'=>'低代码',
            'mode_id'=>'4',
            'mode_num'=>'lists',
            'mode_name'=>'列表管理',
            'database'=>'ruinuo_lists',
            'sub_database'=>[],        ];
        return $data;
    }

    public function InfoForm()
    {
        $data=[
            'power_field'=>[],
            'layout'=>[
                [
                    'field'=>'mode_id',
                    'title'=>'所属控制器',
                    'value'=>'{mode_id}',
                    'tag'=>'select',
                    'only'=>'2',
                    'required'=>'1',
                    'verify'=>'',
                    'options_num'=>'mode_list',
                ],
                [
                    'field'=>'name',
                    'title'=>'名称',
                    'value'=>'',
                    'tag'=>'input',
                    'only'=>'2',
                    'required'=>'1',
                    'verify'=>'',
                ],
                [
                    'field'=>'page_num',
                    'title'=>'每页显示数量',
                    'value'=>'30',
                    'tag'=>'input',
                    'only'=>'2',
                    'required'=>'1',
                    'verify'=>'isinteger',
                ],
                [
                    'field'=>'order_raw',
                    'title'=>'数据排序规则',
                    'value'=>'id desc',
                    'tag'=>'input',
                    'only'=>'2',
                    'required'=>'1',
                    'verify'=>'',
                ],
                [
                    'field'=>'style',
                    'title'=>'风格',
                    'value'=>'',
                    'tag'=>'select',
                    'only'=>'2',
                    'required'=>'1',
                    'verify'=>'',
                    'options_num'=>'lists_style',
                ],
                [
                    'field'=>'tree_field',
                    'title'=>'树形字段',
                    'value'=>'',
                    'tag'=>'input',
                    'only'=>'2',
                    'required'=>'2',
                    'verify'=>'',
                ],
                [
                    'field'=>'tree_show_field',
                    'title'=>'树形显示字段',
                    'value'=>'',
                    'tag'=>'input',
                    'only'=>'2',
                    'required'=>'2',
                    'verify'=>'',
                ],
                [
                    'field'=>'sort',
                    'title'=>'排序',
                    'value'=>'1',
                    'tag'=>'input',
                    'only'=>'2',
                    'required'=>'1',
                    'verify'=>'isinteger',
                ],
                [
                    'field'=>'num',
                    'title'=>'编码',
                    'value'=>'',
                    'tag'=>'ordernum',
                    'only'=>'2',
                    'required'=>'2',
                    'verify'=>'',
                    'num_rule'=>[
                [
                    'rule_val'=>'m_',
                    'rule_type'=>'3',
                ],
                [
                    'rule_val'=>'YYYYMMDDHHIISS',
                    'rule_type'=>'2',
                ],
            ],

                ],
                [
                    'field'=>'power_field',
                    'title'=>'权限字段',
                    'value'=>'',
                    'tag'=>'jsontable',
                    'only'=>'2',
                    'required'=>'2',
                    'verify'=>'',
                    'cols'=>[
                [
                    'field'=>'field',
                    'title'=>'权限字段',
                    'update'=>'input',
                    'minWidth'=>'160',
                    'required'=>'2',
                ],
                [
                    'field'=>'is_path',
                    'title'=>'允许上级查看',
                    'update'=>'switch',
                    'minWidth'=>'160',
                ],
            ],

                ],
                [
                    'field'=>'power_role',
                    'title'=>'通用角色权限',
                    'value'=>'',
                    'tag'=>'select',
                    'only'=>'2',
                    'required'=>'2',
                    'verify'=>'',
                    'options_num'=>'admin_role',
                ],
                [
                    'field'=>'power_department',
                    'title'=>'通用部门权限',
                    'value'=>'',
                    'tag'=>'select',
                    'only'=>'2',
                    'required'=>'2',
                    'verify'=>'',
                    'options_num'=>'department_list',
                ],
                [
                    'field'=>'set_where',
                    'title'=>'查询条件',
                    'value'=>'',
                    'tag'=>'textarea',
                    'only'=>'2',
                    'required'=>'2',
                    'verify'=>'',
                ],
                [
                    'field'=>'is_left',
                    'title'=>'开启左侧',
                    'value'=>'2',
                    'tag'=>'select',
                    'only'=>'2',
                    'required'=>'1',
                    'verify'=>'',
                    'options_num'=>'yesno',
                ],
                [
                    'field'=>'left_title',
                    'title'=>'左侧标题',
                    'value'=>'',
                    'tag'=>'input',
                    'only'=>'2',
                    'required'=>'2',
                    'verify'=>'',
                ],
                [
                    'field'=>'left_type',
                    'title'=>'关联方式',
                    'value'=>'',
                    'tag'=>'select',
                    'only'=>'2',
                    'required'=>'2',
                    'verify'=>'',
                    'options_num'=>'left_type',
                ],
                [
                    'field'=>'left_options',
                    'title'=>'关联数据源',
                    'value'=>'',
                    'tag'=>'select',
                    'only'=>'2',
                    'required'=>'2',
                    'verify'=>'',
                    'options_num'=>'options_list',
                ],
                [
                    'field'=>'left_mode',
                    'title'=>'关联模块',
                    'value'=>'',
                    'tag'=>'select',
                    'only'=>'2',
                    'required'=>'2',
                    'verify'=>'',
                    'options_num'=>'mode_list',
                ],
                [
                    'field'=>'left_key_field',
                    'title'=>'主键字段',
                    'value'=>'value',
                    'tag'=>'input',
                    'only'=>'2',
                    'required'=>'2',
                    'verify'=>'',
                ],
                [
                    'field'=>'left_show_field',
                    'title'=>'显示字段',
                    'value'=>'label',
                    'tag'=>'input',
                    'only'=>'2',
                    'required'=>'2',
                    'verify'=>'',
                ],
                [
                    'field'=>'left_field',
                    'title'=>'关联字段',
                    'value'=>'id',
                    'tag'=>'input',
                    'only'=>'2',
                    'required'=>'2',
                    'verify'=>'',
                ],
            ],
        ];
        return $data;
    }

    public function InfoLists()
    {
        $data=[
            'lists'=>[
                [
                    'name'=>'全部',
                    'num'=>'',
                    'page_num'=>'30',
                    'order_raw'=>'id desc',
                    'power_field'=>[],
                    'power_role'=>'',
                    'power_department'=>'',
                    'set_where'=>'',
                    'table_cols'=>[
                [
                    'field'=>'name',
                    'title'=>'名称',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'',
                    'total'=>'2',
                ],
                [
                    'field'=>'num',
                    'title'=>'编码',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'',
                    'total'=>'2',
                ],
                [
                    'field'=>'order_raw',
                    'title'=>'排序',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'',
                    'total'=>'2',
                ],
                [
                    'field'=>'style',
                    'title'=>'风格',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'',
                    'total'=>'2',
                ],
                [
                    'field'=>'page_num',
                    'title'=>'每页显示数量',
                    'update'=>'',
                    'options'=>'',
                    'search'=>'',
                    'total'=>'2',
                ],
            ],

                ],
            ],
        ];
        return !empty($data['lists']) ? $data['lists'] : [];
    }

}